from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, SelectField, FileField
from wtforms.validators import DataRequired, Length
from flask_wtf.file import FileAllowed

class DesignForm(FlaskForm):
    title = StringField('标题', validators=[DataRequired(), Length(min=2, max=128)])
    category = SelectField('分类', choices=[
        ('居住区景观', '居住区景观'),
        ('公园设计', '公园设计'),
        ('商业景观', '商业景观'),
        ('校园景观', '校园景观')
    ])
    description = TextAreaField('简介', validators=[DataRequired()])
    content = TextAreaField('详细内容', validators=[DataRequired()])
    cover_image = FileField('封面图片', validators=[
        FileAllowed(['jpg', 'jpeg', 'png', 'gif'], '只允许上传图片文件！')
    ])
    images = FileField('案例图片', validators=[
        FileAllowed(['jpg', 'jpeg', 'png', 'gif'], '只允许上传图片文件！')
    ])
    tags = StringField('标签') 